package com.panshi.service.impl;

import com.panshi.vo.PageSizeVO;
import com.panshi.mapper.AnswerMapper;
import com.panshi.service.AnswerService;

import com.panshi.vo.AnswerVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@Service
public class AnswerServiceImpl implements AnswerService {

    @Autowired
    private AnswerMapper answerMapper;

    @Override
    //@CacheEvict(value="personalans",allEntries=true)
    public void deleteAns(int anid) {
        answerMapper.deleteAns(anid);
    }

    @Override
    //@Cacheable(value = "personalans",key = "#root.methodName+#pageSizeVO.startIndex")
    public List<AnswerVO> findAnsQuery(@RequestBody PageSizeVO pageSizeVO) {

        return answerMapper.findAnsQuery(pageSizeVO);
    }

    @Override
   // @Cacheable(value = "personalans",key = "#root.methodName+#pageSizeVO.startIndex")
    public List<AnswerVO> findAssQuery(PageSizeVO pageSizeVO) {
       // pageSizeVO.setStartIndex(pageSizeVO.getStartIndexInfo());
        return answerMapper.findAssQuery(pageSizeVO);
    }

    @Override
    public void updateanswerNo(int aaid) {
        answerMapper.updateanswerNo(aaid);
    }

    @Override
    public Integer queryanswercount(int uid) {
        return answerMapper.queryanswercount(uid);
    }

    @Override
    public Integer queryanswernocount(int uid) {
        return answerMapper.queryanswernocount(uid);
    }


}
